package hu.bme.mit.inf.expendables.entities;
	
import javax.persistence.*;
import hu.bme.mit.inf.expendables.entities.*;
import java.util.List;
import java.util.ArrayList;


@Entity
@Table(name="T_TRANSACTION")
@NamedQueries(
	{
	@NamedQuery(name=Transaction.GET_TRANSACTION,query="SELECT t FROM Transaction t WHERE t.transactionId = :transactionId"),
	@NamedQuery(name=Transaction.GET_TRANSACTIONSAFTERDATE,query="SELECT t FROM Transaction t WHERE t.date > :date")
	})
public class Transaction {
	                        	
	public static final String GET_TRANSACTION = "GetTransaction";
	public static final String GET_TRANSACTIONSAFTERDATE = "GetTransactionsAfterDate";

	//Attributes
	@Temporal(TemporalType.TIMESTAMP)
	private java.util.Date date;
	
	private float cost;
	
	@Id
	@GeneratedValue
	@Column(name="TRANSACTION_ID")
	private long transactionId;
	

	//Reference to User
	@ManyToOne
	@JoinColumn(name = "CUSTOMER_ID")
	private User customer;
	
	//Reference to AppMetadata
	@ManyToOne
	@JoinColumn(name = "APPMETADATA_ID")
	private AppMetadata appMetadata;
	


	//Getters and Setters
	public java.util.Date getDate(){
		return date;
	}
	
	public void setDate(java.util.Date date){
		this.date = date;
	}
	
	public float getCost(){
		return cost;
	}
	
	public void setCost(float cost){
		this.cost = cost;
	}
	
	public long getTransactionId(){
		return transactionId;
	}
	
	public void setTransactionId(long transactionId){
		this.transactionId = transactionId;
	}
	

	public User getCustomer(){
		return customer;
	}
	
	public void setCustomer(User customer){
		this.customer = customer;
	}
		
	public AppMetadata getAppMetadata(){
		return appMetadata;
	}
	
	public void setAppMetadata(AppMetadata appMetadata){
		this.appMetadata = appMetadata;
	}
		
}